#include<fcntl.h>
#include<unistd.h>
#include<stdio.h>

int main()
{
    int fd = open("log.txt",O_RDONLY);
    char buf[128];
    int n=read(fd,buf,sizeof(buf)-1);
    if(n>0)
    {
        buf[n]='\0';
        printf("read:%s\n",buf);
    }
    else
    {
        printf("no data or writer closed\n");
    }
    close(fd);
    return 0;
}